package com.spring.oaassist.web.controller;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.spera.shopoa.util.ShopOaSessionUtil;
import com.spera.shopoa.util.ShopOaSessionUtil.OaUser;
import com.spring.security.core.annotation.OaUserPermission;

@Controller
@RequestMapping(value = "/consumeBackground")
public class ConsumeBackground {
	
	@OaUserPermission(value="/consumeBackground/checkOut")
	@RequestMapping(value = "/checkOut")
    public ModelAndView pubsrc(HttpServletRequest request){
//		OaUser oaUser = ShopOaSessionUtil.getOaUser(request);
//		String deptID =oaUser.getUser_dept_id();
//		String kids_parkID=oaUser.getKids_park_id();
		
		HashMap<String,Object> hm=new HashMap<String,Object> ();
//		hm.put("deptID", deptID);
//		hm.put("kids_parkID", kids_parkID);
//		
//		
//		
		return new ModelAndView("consumeBackground/checkOut",hm);
    }
	
	
	@RequestMapping(value = "/p2")
    public ModelAndView p2(HttpServletRequest request){

		return new ModelAndView("consumeBackground/p2");
    }
	
	
	@RequestMapping(value = "/receipt")
    public ModelAndView receipt(HttpServletRequest request,String html) throws UnsupportedEncodingException{
		
		System.out.println("html"+html);
		
		//String html2 = new String(html.getBytes("iso-8859-1"),"utf-8");
		
		//System.out.println("html2"+html2);
		
		request.setAttribute("html", html);
		request.getSession().setAttribute("html", html);
		
		return new ModelAndView("consumeBackground/receipt");
    }
	
	@RequestMapping(value = "/test")
    public ModelAndView test(HttpServletRequest request){
		return new ModelAndView("consumeBackground/test");
    }
}
